﻿using SuperSocket.SocketBase;

namespace SuperX.SuperSocket.Socket.Server
{
    public class SocketServerConfig
    {
        public Role Role { get; } = Role.Server;  //角色

        public string Ip { get; } = "Any";   //任意的ipv4地址

        public int ListenPort { get; set; } = 9000;   //端口号

        public DataFormat TextEncoding { get; } = DataFormat.UTF8;// 文本的默认编码

        public SocketMode Mode { get; set; } = SocketMode.Tcp;//通讯模式

        public bool ClearIdleSession { get; set; } = true;//是否定时清空闲会话，默认值是 false;

        public string Name { get; set; } = "SuperX.SuperSocket.AppServer";

        public string ServerTypeName { get; } = "SuperX.SuperSocket.Server.SocketServer,SuperX.SuperSocket";

        /**默认值为300，单位为秒;*/
        public int IdleSessionTimeOut { get; set; } = 60;//会话空闲超时时间; 当此会话空闲时间超过此值，同时clearIdleSession被配置成true时，此会话将会被关闭;

        public int ClearIdleSessionInterval { get; set; } = 60;

        public int MaxConnectionNumber { get; set; } = 5000;//线程池最大工作线程数量;

        public int ReceiveBufferSize { get; set; } = 65535; //用于接收数据的缓冲区大小

        public int SendBufferSize { get; set; } = 65535; //用于接收数据的缓冲区大小

        public int MaxRequestLength { get; set; } = 65535; //最大请求长度

        public int SendTimeOut { get; set; } = 600;//发送超时时间

        public bool SyncSend { get; set; } = true;//是否是异步发送。

        public int MaxHeartBeatInterval { get; set; } = 20; //允许最大心跳时间间隔，超过后将抛事件。

        public bool IsEnableHeartBeat { get; set; } = true;

        public bool IsSyncInvoke { get; set; } = false;
    }
}